//
//  RBCartSpecVC.m
//  zhongzhenglu
//
//  Created by mac on 2022/11/29.
//

#import "RBCartSpecVC.h"
#import "RBDefine.h"
#import "UIView+RBAdd.h"
#import "UIScrollView+RBAdd.h"
#import <Masonry.h>
#import "RBThemeConfig.h"
#import <UIColor+YYAdd.h>
#import <UIView+YYAdd.h>

@interface RBCartSpecVC ()

@property(nonatomic, strong) UIScrollView *scrollView;

@end

@implementation RBCartSpecVC

#pragma mark - Lifecycle

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self setup];
}

#pragma mark - Private

- (void)setup
{
    self.title = @"规格";
    self.view.backgroundColor = UIColor.whiteColor;
    [self.scrollView rbSetContentWidth:kRBMainScreenWidth];
    CGFloat padding = Zoom(14);
    for (RBCartSpecModel *model in self.cartSpecArray)
    {
        [self.scrollView addView:[RanTool labelWithFontSize:Zoom(15) weight:1 color:[RBThemeConfig textBlackColor] align:0 text:model.key] withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:padding bottom:padding left:padding right:padding centerX:0];
        [self.scrollView addView:({
            UILabel *view = [RanTool labelWithFontSize:Zoom(13) weight:1 color:[RBThemeConfig textGrayColor] align:0 text:[model.value componentsJoinedByString:@" "]];
            view.numberOfLines = 0;
            view;
        }) withHeight:CGFLOAT_MIN width:CGFLOAT_MIN top:padding bottom:padding left:padding right:padding centerX:0];
    }
}

#pragma mark - Network

#pragma mark - Event

#pragma mark - Setter

#pragma mark - Getter

- (UIScrollView *)scrollView
{
    if(!_scrollView)
    {
        self.scrollView = ({
            UIScrollView *view = UIScrollView.new;
            [self.view addSubview:view];
            [view mas_makeConstraints:^(MASConstraintMaker *make) {
                make.edges.mas_equalTo(0);
            }];
            view;
        });
    }
    return _scrollView;
}

@end
